
import { _decorator, Component, Node, Button, director } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('StartScene')
export class StartScene extends Component {
    @property(Button)
    public playbtn:Button=null;
   
    start () {                                             // onPlayClick里面的this 也能用了
        this.playbtn.node.on('click',this.onPlayClick.bind(this)); //最后的this值传递下去 
        //this.playbtn.node.on('click',this.onPlayClick,this); 
    }

    public onPlayClick(Button)
    {
        console.log('button name:', Button.name)
   
        director.loadScene('Gamescene');
    }

    
}


